import json

with open(r'data.json', 'r', encoding='utf8') as f1:
    dict1 = json.load(f1)  # 读取
dict1['sex'] = '女'
dict1['color'] = '红色'

with open(r'data.json', 'w', encoding='utf8') as f1:
    json.dump(dict1, f1, ensure_ascii=False)  # 写入
